package com.candy.dao.impl;

import com.candy.dao.AccountDao;
import org.springframework.jdbc.core.JdbcTemplate;

public class AccountDaoImpl implements AccountDao {
    private JdbcTemplate jdbcTemplate;
    @Override
    public void addAccount(String name, Integer money) {
        String strSql="update account SET money=money+"+money+" where name='"+name+"'";
        jdbcTemplate.update(strSql);

    }

    @Override
    public void subAccount(String name, Integer money) {
        String strSql="update account SET money=money-"+money+" where name='"+name+"'";
        jdbcTemplate.update(strSql);
    }

    public JdbcTemplate getJdbcTemplate() {
        return jdbcTemplate;
    }

    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }
}
